<?php 
global $options;
foreach ($options as $value) {
    if (get_settings( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; } else { $$value['id'] = get_settings( $value['id'] ); }
}
$dateformat = get_option('date_format');
$timeformat = get_option('time_format');
get_header(); ?>


<div id="content">
<div class="wrap">      

	<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
	<h1 class="archive"><?php _e('Search Results for', 'wpzoom');?>: <?php the_search_query(); ?></h1>
	<div class="navigation">
		<p><span class="older"><?php next_posts_link(__('&lt; older entries', 'wpzoom')) ?></span> / <span class="latest"><?php previous_posts_link(__('newer entries &gt;', 'wpzoom')); ?></span></p>
	</div>
	<div class="sep">&nbsp;</div>

	<div class="posts posts-5">
	<?php
	wp_reset_query();
	
	$i = 0;
	if (have_posts()) : while (have_posts()) : the_post();
	$i++;
	update_post_caches($posts);
	?>
		<div class="post post-small<?php if ($i == 5) {echo" post-last";} ?>">
		<div class="cover"><?php 
			if ( current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail() ) {
				$thumbURL = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), '' );
				$img = $thumbURL[0]; 
			}
				
			else {
				unset($img);
				if ($wpzoom_cf_use == 'Yes')
				{
					$img = get_post_meta($post->ID, $wpzoom_cf_photo, true);
				}
				else
				{
					if (!$img)
					{
						$img = catch_that_image($post->ID);
					}
				}
			}
			if ($img){ 
			$img = wpzoom_wpmu($img);
			?><a href="<?php the_permalink(); ?>" rel="bookmark,nofollow" title="<?php the_title(); ?>"><img src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php echo $img ?>&amp;h=200&amp;w=184&amp;zc=1" height="200" width="184" alt="<?php the_title(); ?>" /></a>
			<?php }	?>
		</div>
		<div class="info"><h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2></div>
		</div><?php if ($i == 5) {$i = 0; echo"<div class=\"clear\">&nbsp;</div><br />";} ?>

	<?php endwhile; 
	else:
	?>
	<h2><?php _e('We could not find any posts related to this search term.', 'wpzoom');?></h2>
	<?php
	
	endif; ?>          
	<div class="clear">&nbsp;</div>
	</div><!-- end .posts .posts-5 -->
	<div class="sep">&nbsp;</div>
        
</div><!-- end .wrap -->
</div><!-- end #content -->
<?php get_footer(); ?>
